﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;

namespace LibNiconico.NiconicoApi.Lives.Broadcast
{
    /// <summary>
    /// ニコニコ生放送開始レスポンス
    /// </summary>
    public class NicoLiveBroadcastStartResponse
    {
        internal NicoLiveBroadcastStartResponse(bool succeed)
        {
            this.Succeed = succeed;
        }
        
        /// <summary>
        /// 成功したか判定
        /// </summary>
        public bool Succeed { get; private set; }


        internal static NicoLiveBroadcastStartResponse Parse(XDocument document)
        {
            var nodes = from node in document.Descendants()
                        where (string)node.Attribute("status") == "ok"
                        select node;

            return new NicoLiveBroadcastStartResponse(nodes.Count() > 0);
        }
    }
}
